/**
 * 
 */
package com.mvc.service.vo.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.mvc.dao.mapper.BaseInfoDao;
import com.mvc.framework.constant.GlobalConstant;
import com.mvc.model.mb.archive.BaseInfo;
import com.mvc.service.vo.BaseInfoService;


/**
 * @author qingjie
 * Date:     2014年9月14日 下午6:48:08 <br/>
 *
 */
@Transactional
@Service
public class BaseInfoImpl implements BaseInfoService {
	
	@Autowired
	private BaseInfoDao baseInfoDao;

	@Override
	public List<BaseInfo> select(String idCard) {
		List<BaseInfo> list = null;
		//查询
		switch (GlobalConstant.systemType) {
		case 0:
			list = baseInfoDao.select(idCard);
			break;
		case 1:
			list = baseInfoDao.select_mb(idCard);
			break;
		default:
			break;
		}
		return list;
	}

	@Override
	public void insert(BaseInfo info) {
		//插入
		switch (GlobalConstant.systemType) {
		case 0:
			baseInfoDao.insert(info);
			break;
		case 1:
			baseInfoDao.insert_mb(info);
			break;
		default:
			break;
		}
	}

	@Override
	public int maxId(String userCode) {
		String value = baseInfoDao.selectMax(userCode);
		int maxId = 1;
		if(value!=null){
			maxId = Integer.parseInt(value)+1;
		}
		return maxId;
	}

}
